<template>
    <div>
        <el-dialog :title="dialogtitle" width="800px" class="icon-dialog" :visible.sync="show" :before-close="closeForm" append-to-body @open="open">
            <el-form ref="form" :size="size" :model="form" :rules="rules" :label-width="$store.getters.device !== 'mobile'?'16%':'90px'">
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="是否已处理" prop="status">
                            <el-radio-group v-model="form.status">
                                <el-radio :label="1">是</el-radio>
                                <el-radio :label="3">否</el-radio>
                            </el-radio-group>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="用户">
                            <div>{{ form.member.nickname }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="手机号码">
                            <div>{{ info.mobile }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="邮箱">
                            <div>{{ info.email }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="内容">
                            <div>{{ info.message	 }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="图片" prop="images">
                            <div v-for="(item,index) in info.image" :key="index" style="margin-right: 10px;">
                                <el-image class="table_list_pic" :src="item" :preview-src-list="[item]" />
                            </div>                            
                        </el-form-item>
                    </el-col>
                </el-row>
                <el-row>
                    <el-col :span="24">
                        <el-form-item label="反馈时间">
                            <div>{{ info.create_time }}</div>
                        </el-form-item>
                    </el-col>
                </el-row>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button :loading="loading" type="primary" @click="submit">
                    <span v-if="!loading">确 定</span>
                    <span v-else>提 交 中...</span>
                </el-button>
                <el-button @click="closeForm">取 消</el-button>
            </div>
        </el-dialog>
    </div>
</template>
<script>
export default {
    name: 'Articleupdate',
    components: {},
    props: {
        show: {
            type: Boolean,
            default: false
        },
        size: {
            type: String,
            default: 'small'
        },
        info: {
            type: Object
        }
    },
    data() {
        return {
            dialogtitle: '',
            form: {
                status: 1,
                member: {}
            },
            loading: false,
            rules: {
            }
        }
    },
    watch: {
        show(val) {
        }
    },
    methods: {
        open() {
            this.dialogtitle = '反馈详情'
            this.form = this.info
            console.log(this.form.member.nickname)
        },
        submit() {
            this.$refs['form'].validate(valid => {
                if (valid) {
                    this.loading = true
                    this.$api.post('/Feedback/listUpdate', this.form).then(res => {
                        this.$message({
                            message: res.msg,
                            type: 'success'
                        })
                        this.$emit('refesh_list')
                        this.closeForm()
                    }).catch(() => {
                        this.loading = false
                    })
                }
            })
        },
        closeForm() {
            this.$emit('update:show', false)
            this.loading = false
            if (this.$refs['form'] !== undefined) {
                this.$refs['form'].resetFields()
            }
        }
    }
}
</script>
<style>
.el-form-item__content{
    display: block ruby;
}
</style>